<template>
  <div :id="'mteditorImageMenu'+editIndex" @click.stop>
    <ul>
      <!-- <li>
        <span>宽:</span>
        <input
          type="number"
          v-model.number="imageSize.imageWidth"
          @keydown.enter="setSize"
        />
      </li> -->
      <li>
        <span>缩放</span>
        <input
          type="range"
          v-model="imageSize.imageWidth"
          @input="setSize"
          min="10"
        />
        <span>{{ imageSize.imageWidth }}%</span>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  props: {
    editIndex: {
      type: Number,
      default: 0
    }
  },
  data () {
    return {
      imgMenu: [],
      imageSize: {
        imageWidth: 100,
        imageHeight: 0
      },
    }
  },
  mounted () {
    this.$emit('imageMenuMounted')
  },
  methods: {
    setSize () {
      this.imageSize.imageWidth
      this.$emit('changeImageSize', this.imageSize);
    }
  }
}
</script>

<style scoped>
ul {
  list-style: none;
  background-color: white;
  width: 60px;
  height: 200px;
}
ul li {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 10px ;
  box-sizing: border-box;
  font-size: 10px;
}
ul li input {
  transform: rotate(90deg);
  width: 250px;
}
#mteditorImageMenu {
  list-style: none;
  margin: 0;
  background: rgb(255, 255, 255);
  font-size: 12px;
  box-shadow: 0 0 2px 2px lightgray;
  display: none;
}
#mteditorImageMenu ul li {
  height: 200px;
  width: 40px;
  padding: 5px;
  text-align: center;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
}
#mteditorImageMenu ul li input {
  /* width: 100px; */
}
#mteditorImageMenu ul li span {
  display: inline-block;
  flex-shrink: 0;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 140px;
}
input[type="range"]:focus {
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  animate: 0.2s;
  background: #d8d8d8;
}
input[type="range"]::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #389cbb;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -9px;
}
input[type="range"]:focus::-webkit-slider-runnable-track {
  background: #d8d8d8;
}
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  animate: 0.2s;
  background: #d8d8d8;
}
input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #389cbb;
  cursor: pointer;
}
input[type="range"]::-ms-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  animate: 0.2s;
  background: transparent;
  border-color: transparent;
  border-width: 16px 0;
  outline: none;
  color: transparent;
}
/* IE上层滑道填充 */
input[type="range"]::-ms-fill-lower {
  background: #d8d8d8;
  border: 0.2px solid #d8d8d8;
}
/* IE下层滑道填充 */
input[type="range"]::-ms-fill-upper {
  background: #d8d8d8;
  border: 0.2px solid #d8d8d8;
}
input[type="range"]::-ms-thumb {
  height: 18px;
  width: 18px;
  border-radius: 9px;
  background: #389cbb;
  cursor: pointer;
  border: 0;
}
input[type="range"]:focus::-ms-fill-lower {
  background: #389cbb;
}
input[type="range"]:focus::-ms-fill-upper {
  background: #389cbb;
}
</style>
